export let option = function option() {
    let that = this
    return {
        tooltip: {
            trigger: 'item'
        },
        color: ["#37a2da", "#9fe6b8", "#6a8ddc", "#ff9f7f"],
        series: [
            {

                type: 'pie',
                radius: ['50%', '75%'],
                avoidLabelOverlap: false,
                itemStyle: {
                    borderRadius: 4,
                    borderWidth: 9
                },
                label: {
                    formatter: '{b}\n{d}%',
                    show: true,
                    color: "#FFFFFF",
                    minMargin: 2,
                    lineHeight: 20,
                    fontSize: 16
                },
                labelLine: {
                    show: true
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: 16,
                        color: "auto",
                        fontWeight: "bold"
                    },
                },
                data: [
                    { value: 7000, name: '切割耗能' },
                    { value: 17000, name: '磨边耗能' },
                    { value: 12000, name: '钢化耗能' },
                    { value: 15000, name: '中空耗能' },
                ],
                labelLayout: function (params) {
                    // console.log(that);
                    const isLeft = params.labelRect.x < that.instance.getWidth() / 2;
                    const points = params.labelLinePoints;
                    // Update the end point.
                    points[2][0] = isLeft
                        ? params.labelRect.x
                        : params.labelRect.x + params.labelRect.width;
                    return {
                        labelLinePoints: points
                    };
                },
            }
        ]
    };
}